﻿/**
 * Description：特殊过程查看 hooks
 * Copyright (c) : 通力凯顿（北京）系统集成有限公司
 * Writer：longb
 * date: 2025.5.21
 */
const { ref, reactive, nextTick } = Vue
import { commonFetch } from '../../../Scripts/ZsJs/commonFetch.js'
const { ElMessage, ElMessageBox } = ElementPlus
export function useSpecialCourse() {
  const specialCourse = reactive({
    specialCourseViewDialogVisible: false,
    specialCourseDataList: [],
    specialCourseDetailList: []
  })
  //查询特殊过程列表信息
  async function getSpecialCourseDataList(workflowids) {
    if (workflowids == '') {
      return;
    }
    const formData = new FormData();
    formData.append('workflowids', workflowids);
    const { tdata, Result } = await commonFetch({
      url: `../../../Ashx/ProductWorkflowDataViewVue3PageHandler.ashx?action=getSpecialCourseDataList`,
      data: formData
    });
    specialCourse.specialCourseDetailList = [];
    specialCourse.specialCourseViewDialogVisible = true;
    specialCourse.specialCourseDataList = tdata
  }

  //查询特殊过程明细信息
  async function getSpecialCourseDetailList(specialcoursespecreportno) {
    const formData = new FormData();
    formData.append('specialcoursespecreportno', specialcoursespecreportno);
    const { tdata, Result } = await commonFetch({
      url: `../../../Ashx/ProductWorkflowDataViewVue3PageHandler.ashx?action=getSpecialCourseDetailList`,
      data: formData
    });
    specialCourse.specialCourseDetailList = tdata
  }

  return {
    specialCourse,
    getSpecialCourseDataList,
    getSpecialCourseDetailList
  }
}